import * as actionTypes from '../constraint/app.js'

export function loadGraph (userId,width) {
  return {
    type: actionTypes.LOAD_REQUEST,
    userId:userId,
    width:width
  }
}

export function changeLegend (selectStatus) {
  return {
    type: actionTypes.SELECT_LEGEND_CHANGE,
    selectStatus:selectStatus
  }
}

export function sourceFilter (data) {
  return {
    type: actionTypes.SOURCE_FILTER,
    data:data
  }
}

export function refreshGraph (graphId) {
  return {
    type:  actionTypes.REFRESH_GRAPH
  }
}

export function Author (graphId) {
  return {
    type:  actionTypes.AUTHOR
  }
}

export function reLayout (num, props) {
  return {
    type:  actionTypes.RE_LAYOUT,
    oldValue: Object.assign({}, props,{col:num})
  }
}

export function setFreezeState (isFreeze,props) {
  return {
    type:  actionTypes.FIX_BOARD,
    freezeState:Object.assign({}, props,{isFreeze: isFreeze}) 
  }
}
   // this.props.charts.forEach(setting => {
   //   this.props.charts[setting].shouldUpdate = false
   // })
export  function setDataActiveStatus (setting) {
  return {
    type:  actionTypes.DATA_ACTIVE_STATUS,
    modifiDataUpdate:Object.assign({}, setting) 
  }
} 